{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "526330c1",
   "metadata": {},
   "source": [
    "【简答题】练习3-01：\n",
    "\n",
    "回文（palindrome）是正读或者反读都相同的单词或短语，忽略空格和字母大小写。例如，下面的示例都是回文：warts n straw、radar、xyzczyx\n",
    "\n",
    "编写一个程序，判断输入的字符串是否是回文。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "49be02d3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "abcba is a palindrome.\n",
      "jj is a palindrome.\n",
      ";lkj is not a palindrome.\n"
     ]
    }
   ],
   "source": [
    "def is_palindrome(s):\n",
    "    return s == s[::-1]\n",
    "\n",
    "while True:\n",
    "    word = input('Enter a word:')\n",
    "    if word == 'q' or word == 'e':\n",
    "        break\n",
    "    elif is_palindrome(word):\n",
    "        print(f'{word} is a palindrome.')\n",
    "    else:\n",
    "        print(f'{word} is not a palindrome.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "dff5966b",
   "metadata": {},
   "outputs": [],
   "source": [
    "def is_num(n2):\n",
    "    n3 = n2 * n2\n",
    "\n",
    "for i in range(10, 100):\n",
    "    ..."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
